package com.yanqu.road.server.manager.activity.celebration;

import com.yanqu.road.entity.log.LogCelebrationFestiveCrossChange;
import com.yanqu.road.logic.bussiness.log.LogBussiness;
import org.apache.commons.collections.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description
 * @Author cwq
 * @Data 2022/4/25 11:32
 */
public class CelebrationLogMgr {

    private static List<LogCelebrationFestiveCrossChange> logCelebrationFestiveCrossChangeList = new ArrayList<>();

    public static void addLogCelebrationFestiveChange(LogCelebrationFestiveCrossChange log) {
        synchronized (logCelebrationFestiveCrossChangeList) {
            logCelebrationFestiveCrossChangeList.add(log);
        }
    }


    public static void saveLog(){
        if (!CollectionUtils.isEmpty(logCelebrationFestiveCrossChangeList)) {
            List<LogCelebrationFestiveCrossChange> list;
            synchronized (logCelebrationFestiveCrossChangeList) {
                list = new ArrayList<>(logCelebrationFestiveCrossChangeList);
                logCelebrationFestiveCrossChangeList.clear();
            }
            LogBussiness.addLogCelebrationFestiveCrossChange(list);
        }
    }
}
